package unclevenn.cloudmusic.common;

import com.alibaba.fastjson.JSONObject;
import org.springframework.http.HttpStatus;

public class Response {
    public static JSONObject success(Object result) {
        JSONObject response = new JSONObject();
        response.put("result", result);
        response.put("code", HttpStatus.OK.value());
        response.put("msg", "success");
        return response;
    }

    public static JSONObject error(String msg) {
        JSONObject response = new JSONObject();
        response.put("result", null);
        response.put("code", HttpStatus.BAD_REQUEST.value());
        response.put("msg", msg);
        return response;
    }
}
